//
// Simple passthrough vertex shader
//
attribute vec3 in_Position;//应该是buffer中的坐标也就是墙体的坐标                  // (x,y,z)
uniform vec2 u_pos;//指的是light的坐标
varying float ldis;
varying float tdis;
const float len = 100000.;
void main()
{
	vec2 pos = in_Position.xy;
	vec2 dis = pos - u_pos;
	float sdis = length(dis);
	if(in_Position.z > 1.)
	{
		//sqrt(dis.x * dis.x + dis.y * dis.y)指dis方向的单位矢量
		pos += dis / sdis * len;//指原来的点坐标 要加上dis方向*100000像素的 距离
		tdis = in_Position.z - 2.;
		ldis = 1.;
	}
	else
	{
		ldis = sdis / len;
		tdis = mix(0.5, in_Position.z, ldis);
	}
    vec4 object_space_pos = vec4( pos.x, pos.y, 0., 1.0);
    gl_Position = gm_Matrices[MATRIX_WORLD_VIEW_PROJECTION] * object_space_pos;
    
}
